package com.onec.service.customer.entity.agent;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.onec.service.api.enums.ProductEnum;
import com.onec.service.api.enums.StatusEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 代理商:代理业务：
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_agent_business")
public class AgentBusiness implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Column(name = "version", length = 8)
    private Integer version;

    /**
     * 业务编号
     */
    @Column(name = "business_no", length = 16, unique = true)
    private String businessNo;

    @Column(name = "product", length = 8)
    @Enumerated(EnumType.STRING)
    private ProductEnum product;
    /**
     * 机构编号
     */
    @Column(name = "agent_id", length = 16)
    private Long agentId;
    /**
     * 创建时间
     */
    @Column(name = "create_time", length = 0)
    @Temporal(TemporalType.TIMESTAMP)
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date createTime;
    /**
     * 变更
     */
    @Column(name = "update_time", length = 0)
    @LastModifiedDate
    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm", timezone = "GTM+8")
    private Date updateTime;
    /**
     * 创建者
     */
    @Column(name = "creator", length = 32)
    private String creator;
    /**
     * 产品备注
     */
    @Column(name = "remarks", length = 64)
    private String remarks;
    /**
     * 通道状态
     */
    @Column(name = "status", length = 12)
    @Enumerated(EnumType.STRING)
    private StatusEnum status;

    /**
     * 交易费率:
     * scale 配置小数点的位数：
     */
    @Column(name = "rate", length = 8, scale = 4)
    private BigDecimal rate;

    /**
     * 提现费率
     */
    @Column(name = "fee", length = 8, scale = 1)
    private BigDecimal fee;

    /**
     * 提现费率
     */
    @Column(name = "max_fee", length = 8, scale = 1)
    private BigDecimal maxFee;

    /**
     * 提现费率
     */
    @Column(name = "max_rate", length = 8, scale = 4)
    private BigDecimal maxRate;


    public AgentBusiness() {
    }


}
